-
Notifications
You must be signed in to change notification settings - Fork 705
feat: Implement hyperbolic defense bonus and upgradability for Defens… #2296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
|
|
Warning Rate limit exceeded@ryanbarlow97 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 10 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (2)
WalkthroughThe Config API's Changes
Sequence Diagram(s)sequenceDiagram
participant Attacker as Attack logic
participant Config as DefaultConfig
participant Unit as DefensePost unit
Attacker->>Unit: find defense post (dp)
Note over Unit: dp.unit.level() → level
Attacker->>Config: defensePostDefenseBonus(level)
Config-->>Attacker: numeric bonus (level-scaled)
Attacker->>Attacker: apply bonus in damage calculation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Suggested labels
Pre-merge checks❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/core/configuration/DefaultConfig.ts (1)
310-312: Consider adding explanatory comments for the formula constants.The magic numbers reduce readability. Add a brief comment explaining the hyperbolic curve behavior and why these specific values were chosen.
Example:
defensePostDefenseBonus(level: number): number { + // Hyperbolic formula providing diminishing returns: + // Level 1: 5x defense, Level 2: ~8.3x, Level 3: 10x, Max (∞): 15x const baseValue = 5; const maxIncrease = 10; const k = 2; return baseValue + maxIncrease * ((level - 1) / (level - 1 + k)); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/core/configuration/Config.ts(1 hunks)src/core/configuration/DefaultConfig.ts(3 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/core/configuration/Config.ts (2)
src/core/game/UnitImpl.ts (1)
level(406-408)src/core/game/GameView.ts (1)
level(167-169)
src/core/configuration/DefaultConfig.ts (2)
src/core/game/UnitImpl.ts (1)
level(406-408)src/core/game/GameView.ts (1)
level(167-169)
🔇 Additional comments (2)
src/core/configuration/DefaultConfig.ts (1)
672-673: LGTM!The call site correctly passes the unit level to compute the dynamic defense bonus. The bonus is properly applied as a multiplier to the magnitude.
src/core/configuration/Config.ts (1)
154-154: All call sites verified and properly updated.The signature change has been correctly implemented. The only call site in the codebase (DefaultConfig.ts:672) already passes the
levelparameter viadp.unit.level(), matching the new interface requirement.
| )) { | ||
| if (dp.unit.owner() === defender) { | ||
| mag *= this.defensePostDefenseBonus(); | ||
| mag *= this.defensePostDefenseBonus(dp.unit.level()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this only checks if we have a stacked defense post, but we should also reduce speed if multiple defense posts are nearby
|
This pull request is stale because it has been open for fourteen days with no activity. If you want to keep this pull request open, add a comment or update the branch. |
…e Posts
Description:
Added a new hyperbolic formula for defensePostDefenseBuff with diminishing returns and upgradability for defense posts.
Variables
Y = total defense bonus (constant)
X = level of defense post (constant)
B = base constant of level 1 defense post (constant)
M = asymptote of the function
K = changes steepness of the curve
Formula: Y = B + M * ((X - 1) / (X - 1 + K))
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
restart